<?php

class app_content extends app
{

	public function __construct()
	{
		parent::__construct( 'content', '文章管理', 'apps/content/images/content.gif' );
	}

	
    protected function set_links()
    {
        // 新建前台菜单时可用的链接项
        $this->add_link('文章列表页面', './?action=content.article.listing');
        
        $param = new stdClass();
        $param->name = 'category_id';
        $param->label = '选择分类';
        $options = array();
        $db = bone::get_db();
        $objs = $db->get_objs('SELECT `id`,`name` FROM `bone_content_category`');
        foreach ($objs as $obj)
        {
            $options[$obj->id] = $obj->name;
        }
        $param->options = $options;
        $this->add_link('指定分类文章列表页面', './?action=content.article.listing', array($param));
        
        $this->add_link('指定为首页的文章', './?action=content.article.home');
        
        $param = new stdClass();
        $param->name = 'article_id';
        $param->label = '选择文章';
        $options = array();
        $objs = $db->get_objs('SELECT `id`,`title` FROM `bone_content_article`');
        foreach ($objs as $obj)
        {
            $options[$obj->id] = $obj->title;
        }
        $param->options = $options;
        $this->add_link('指定的一篇文章', './?action=content.article.detail', array($param));
    }
	
	
    protected function set_menus()
	{
		$this->add_menu('文章列表', './?action=content.article.listing', 'apps/content/images/articles.gif' );
        $this->add_menu('添加文章', './?action=content.article.edit', 'apps/content/images/new.gif' );
		$this->add_menu('分类管理', './?action=content.category.listing', 'apps/content/images/category.gif' );
	}


}
?>